package com.hongyuan.sellfitness.ui.person.view_mode;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.hongyuan.mvvmhabitx.binding.command.BindingAction;
import com.hongyuan.mvvmhabitx.binding.command.BindingCommand;
import com.hongyuan.sellfitness.base.ItemViewModel;
import com.hongyuan.sellfitness.ui.find.beans.FindChildTopBean;
import com.hongyuan.sellfitness.ui.person.activity.UserInfoActivity;

public class AttentionItemViewModel extends ItemViewModel<AttentionViewModel> {

    public ObservableField<FindChildTopBean.ListBean> entity = new ObservableField<>();

    public AttentionItemViewModel(@NonNull AttentionViewModel viewModel, FindChildTopBean.ListBean bean) {
        super(viewModel);
        entity.set(bean);
    }

    //条目的点击事件
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("user_id",String.valueOf(entity.get().getF_mid()));
            bundle.putString("userPhone",entity.get().getM_mobile());
            viewModel.startActivity(UserInfoActivity.class,bundle);
        }
    });

    //取消关注
    public BindingCommand cancelAttention = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            //设置要操作的对象
            viewModel.itemClick(AttentionItemViewModel.this);

            //弹框提示是否需要操作
            viewModel.uc.showCancel.call();
        }
    });
}
